<html>
<head>
    <title>Site submission results</title>
</head>

<body>
    <h1>Site submission results</h1>
    
    <?php

    require_once('../util.php');

    // extract form sites
    $url = $_POST['url'];
    $email = $_POST['email'];

    $mxhostarr = array();

    $url = parse_url($url);
    $host = $url['host'];
    if (!($ip = gethostbyname($host))) {
        preEcho('Host for URL does not have valid IP');
        exit;
    }
    
    preEcho("Host is at ip: {$ip}");

    $email = explode('@', $email);
    $emailhost = $email[1];
    preEcho($email);

    if (!dns_get_mx($emailhost, $mxhostsarr)) {
        preEcho("Email address is not at valid host");
        exit;
    }

    preEcho("Email is delivered via: ");
    foreach ($mxhostarr as $mx) {
        preEcho($mx);
    }

    // if reached here all ok 
    preEcho('<br />All submitted details are ok.<br />');
    ?>
</body>
</html>
    
